// 5.9 Sentinels

#include <stdio.h>
int main() 
{
    float grade;
    float total=0;
    int result;
    char inputChar;

    printf("\nTo stop entering grades, press either the F6 key");
    printf("\n or the ctrl and Z keys simulataneously on PCs");
    printf(" IBM compatible computers");
    printf("\n or the ctrl and D keys for UNIX operating systems.\n\n");
    printf("Enter a grade: ");
       
    while ((result=scanf("%f",&grade))!= EOF)
    {
        if(0==result)
           {
               scanf("%c",&inputChar);
               printf("=>Should pass %c\n",inputChar);
           }
           else
        total+=grade;    
        printf("Enter a grade: ");          
    }

    printf("\nThe total of grades is %f\n",total);
    
    return 0;
}